package com.leyou.trade.utils;

/**
 * @author 虎哥
 */
public class UserHolder {
    private static final ThreadLocal<Long> TL = new ThreadLocal<>();

    public static void setUser(Long userId){
        TL.set(userId);
    }

    public static Long getUser(){
        Long userId = TL.get();
        if(userId == null) {
            return 0L;
        }
        return userId;
    }

    public static void remove(){
        TL.remove();
    }
}
